home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Games
/
NeXTmille
/
Source
/
GameCoordinator.h
< prev
next >
Wrap
Text File
|
1991-01-11
|
4KB
|
119 lines
/* Generated by Interface Builder */
#import <objc/Object.h>
#import <appkit/Text.h>
#import <appkit/Window.h>
#import "CardsTracker.h"
#import "CardHolder.h"
#import "CardView.h"
#import "DragCoordinator.h"
#import "DrawPileStackView.h"
#import "Player.h"
#import "StackView.h"
// Theere is only one game coordinator object. There is only one game.
// The game coordinator coordinates the activities between the user and the
// players. This includes new hands, games, and the prompting of the user
// for information or decisions.
// This data type is used to dictate a card class and the
// number of instances of that class required for the
// deck of cards.
// cardType is a tag value assigned to each card as it is
// created. It identifies the card type.
typedef struct _cardDeckCell { STR cardClassName;
int numCards;
int cardType;
} cardDeckCell;
extern cardDeckCell cardDeck[];
// This is the game coordinator.
// There is only one instance of this class.
@interface GameCoordinator:Object
{
// All of the objects listed below are set by the .nib
// dearchiving method.
DrawPileStackView *drawPile;
StackView *discardPile;
Text *messagesText;
Window *gameWindow,
*scoreWindow,
*cardsPlayedWindow;
Player *player,
*computerPlayer;
CardsTracker *cardsTracker;
// This object is stored only so that it can be passed to
// each card instance; Otherwise, it isn't used by this
// object.
DragCoordinator *dragCoordinator;
// This is the distance goal for the current hand.
int handLimit;
// This flag indicates the computer is playing itself.
// It is a menu selection.
BOOL computerVsComputerFlag;
// This variable holds the last player to
// shuffle the deck. The player to the
// dealers left goes first. So, how does this work?
// The first shuffler is the player. Then
// we alternate between players.
Player *lastShuffler;
}
// These methods set the outlets for instances of this
// class.
- setMessagesText:( Text * )anObject;
- setDrawPile:( DrawPileStackView * ) anObject;
- setDiscardPile:( StackView * ) anObject;
// Return the windows.
- ( Window * )gameWindow;
- ( Window * )scoreWindow;
- ( Window * )cardsPlayedWindow;
// The instance of this class is a delegate of the
// application object. This method is used to notify
// the coordinator to get things rolling.
- appDidInit:sender;
// Action message sent by a menu selection.
// Chooses computer vs computer. Displays
// a alert panel the sends the play
// method to both players until the
// alert is canceled.
- computerVsComputer:sender;
// These methods are the game itself.
// Begin a new game. Start a new hand.
// If either player's score is over the game
// limit then prompt to play another game.
- newGame;
// Begin a new hand. Total each player's score.
// Send all cards back to the draw pile, turn
// them face down, and shuffle the deck. Deal a new
// hand.
- newHand;
// Shuffle the cards in the draw pile.
- shuffleDeck;
// The hand limit is extended either by operator
// selection or the computer.
// Many objects want to know the distance goal.
- setHandLimit:( int )aLimit;
- ( int )handLimit;
// Message comes from player Player object.
// It requesting the player for a
// game extension.
// returns TRUE if extension is granted.
- ( BOOL )willPlayerExtend;
// This method comes from one of the plater
// objects when it detects the hand is over.
// This method will either initiate a new hand
// or a new game.
- handOver;
@end